<template>
  <div>
    <div>
      <homePage></homePage>
    </div>
    <div class="flexdiv">
      <img class="logo" src="../assets/home/logo.png" />
    </div>
    <div class="flexdiv">
      <div class="top-search">
        <div class="search-box">
          <span class="subjectleft">
            <el-select v-model="value" placeholder="请选择" class="selectbox">
              <el-option
                v-for="item in options"
                :key="item.value"
                :label="item.label"
                :value="item.label"
              >
              </el-option>
            </el-select>
          </span>

          <input
            type="text"
            name="search"
            class="search-left"
            placeholder="中文文献、外文文献"
            v-model="input"
          />

          <span class="el-icon-search" @click="to_search_result"></span>
        </div>
      </div>
    </div>
    <div class="flexdiv">
      <div class="headline1">
        <hr class="line" />
        <p class="title1">热点前沿</p>
        <hr class="line" />
      </div>
    </div>
    <div class="hot_show">
      <div class="left_board">
        <div class="left_up_block">
          <img src="../assets/home/hot1.png" alt="hot1" class="left_up_photo" />
          <p class="left_up_title1" @click="to_paper_info(0)">{{ left_up_title1 }}</p>
          <p class="left_up_title2" @click="to_paper_info(0)">{{ left_up_title2 }}</p>
          <p class="left_up_title3" @click="to_paper_info(0)">{{ left_up_title3 }}</p>
          <p class="left_up_title4" @click="to_paper_info(0)">{{ left_up_title4 }}</p>
        </div>
        <div class="left_down_block">
          <div class="left_down_title_block1">
            <p class="left_down_title1">{{ left_down_title1 }}</p>
            <p class="left_down_title2">{{ left_down_title2 }}</p>
            <p class="left_down_title3" @click="to_paper_info(1)">{{ left_down_title3 }}</p>
            <p class="left_down_title4">{{ left_down_title4 }}</p>
            <hr class="line3" />
          </div>
          <div class="left_down_title_block2">
            <p class="left_down_title1">{{ left_down_title5 }}</p>
            <p class="left_down_title2">{{ left_down_title6 }}</p>
            <p class="left_down_title3" @click="to_paper_info(2)">{{ left_down_title7 }}</p>
            <p class="left_down_title4">{{ left_down_title8 }}</p>
            <hr class="line4" />
          </div>
        </div>
      </div>
      <div class="right_board">
        <div class="right_up_block">
          <div class="right_up_photo_block">
            <img src="../assets/home/hot2.png" alt="hot3" class="right_up_photo" />
          </div>
          <p class="right_up_title1">{{ right_up_title1 }}</p>
          <p class="right_up_title2">{{ right_up_title2 }}</p>
          <p class="right_up_title3" @click="to_paper_info(3)">{{ right_up_title3 }}</p>
          <p class="right_up_title4">{{ right_up_title4 }}</p>
          <hr class="line2" />
        </div>
        <div class="right_down_block">
          <div class="right_down_photo_block">
            <img
              src="../assets/home/hot3.png"
              alt="hot3"
              class="right_down_photo"
            />
          </div>
          <p class="right_down_title1">{{ right_down_title1 }}</p>
          <p class="right_down_title2">{{ right_down_title2 }}</p>
          <p class="right_down_title3" @click="to_paper_info(4)">{{ right_down_title3 }}</p>
          <p class="right_down_title4">{{ right_down_title4 }}</p>
          <hr class="line2" />
        </div>
      </div>
    </div>
    <div class="recommend">
      <div class="recom_title_block">
        <i class="el-icon-s-flag"></i>
        <p class="recom_title">推荐</p>
      </div>
      <el-card class="recom_board">
        <div class="recom_entry" v-for="v of recom_data.length" :key="v">
          <div class="recom_entry_title">
            <p class="recom_type">期刊</p>
            <p class="recom_entry_title_content" @click="pid=recom_data[v-1].id;toPaperInfo()">
              {{recom_data[v-1].title}}
            </p>
          </div>
          <p class="recom_entry_content" v-if="recom_data[v-1].abstract">
            {{recom_data[v-1].abstract}}
          </p>
          <p class="recom_entry_bottom" v-if="recom_data[v-1].authors[0]" @click="sid=recom_data[v-1].authors[0].id;toScholar()">
            {{recom_data[v-1].authors[0].name}}&emsp;&emsp;|&emsp;&emsp;{{recom_data[v-1].year}}
          </p>
          <hr class="line5" v-if="v!=recom_data.length"/>
        </div>
        
      </el-card>
    </div>
    <div class="page_bottom">
      <bottom-info></bottom-info>
    </div>
  </div>
</template>

<script>
import bottomInfo from "../components/bottomInfo.vue";
import homePage from '../components/homePage.vue'
export default {
  components:{
    'bottom-info':bottomInfo, //挂载底部组件
    homePage,
  },
  data() {
    return {
      paperID:["53e997c6b7602d9701fb731d","53e99ae2b7602d97023699d0","53e9abebb7602d97035a9330","53e997e8b7602d9701fdfbf4","53e99b16b7602d97023a8c7f"],//left_up,left_down1,left_down2,right_up,right_down
      options: [
        {
          value: "1",
          label: "主题",
        },
        {
          value: "2",
          label: "标题",
        },
        {
          value: "3",
          label: "作者",
        },
        {
          value: "4",
          label: "机构",
        },
        {
          value: "5",
          label: "期刊号",
        },
      ],
      value: "",
      input: "",
      left_up_title1: "J CRYPTOL | 2018",
      left_up_title2: "Robust Encryption",
      left_up_title3: "MICHEL ABDALLA, MIHIR BELLARE, ET AL.",
      left_up_title4:
        "We provide a provable-security treatment of “robust” encryption. Robustness means it is hard to produce a ciphertext that...",
      right_up_title1: "HANDBOOK OF MODEL CHECKING",
      right_up_title2: "2018",
      right_up_title3: "Binary Decision Diagrams",
      right_up_title4: "BY BEATE BOLLIG, MARTIN SAUERHOFF,ET AL.",
      right_down_title1: "ENCYCLOPEDIA OF GIS",
      right_down_title2: "2017",
      right_down_title3: "Simultaneous Localization and Mapping",
      right_down_title4: "BY SEBASTIAN THRUN.",
      left_down_title1: "SIAM J COMPUT",
      left_down_title2: "2 AUG 2017",
      left_down_title3:
        "Towards interactive query expansion",
      left_down_title4: "BY DONNA HARMAN.",
      left_down_title5: "CoRR",
      left_down_title6: "19 AUG 2018",
      left_down_title7: "Evolving algebras 1993: Lipari guide",
      left_down_title8: "BY YURI GUREVICH.",

      recom_data:[
        {
          year: 1, 
          abstract: '', 
          id: '', 
          title: "",
          authors: [
            {name:"",id:""}
          ]
        }
      ],
      pid: 1,
      sid: 1
    };
  },
  methods: {
    to_search_result(){
      // esQ
      this.$router.push({name:"SearchResult",params:{filter:this.value,content:this.input,isFromAdvance:false}});
    },
    to_paper_info(index){
      this.$router.push({name:'paperInfo',params:{pid:this.paperID[index]}});
    },
    toPaperInfo(){
      if(document.cookie!='')
        this.$router.push({name:'paperInfo',params:{pid:this.pid}});
      else
      {
        setTimeout(() => {
        this.$message.warning('当前未登录，即将跳转至登录界面');
      }, 2000)
        this.$router.push({name: 'login'});
      }
    },
    toScholar(){
      if(this.sid)
      this.$router.push({name:'scholarprofile',params:{sid:this.sid}});
    }
  },
  created() {
    this.value = this.options[0].label; // 初始化时设置下拉框默认值为"主题"

    //api/ getRecommendArticle
    this.$axios({
          method: "get",
          url: '/api/getRecommendArticle',
        })
        .then(res =>{
          console.log(res.data.post.paper);
          this.recom_data=res.data.post.paper;
          
        })
  },
};
</script>

<style scoped>
.page_bottom{
  height:110px;
  width:100%;
  margin:auto;
  margin-top:9%;
}

.flexdiv {
  display: flex;
  justify-content: space-around;
  margin-top: 40px;
}

.headline1 {
  display: flex;
  justify-content: space-around;
  margin-top: 35px;
  padding-bottom: 20px;
}

.line {
  height: 1.5px;
  width: 60px;
  margin-right: 30px;
  margin-left: 20px;
  margin-top: 31px;
}

.line2 {
  position: relative;
  top: -50px;
  height: 2px;
  width: 100%;
  color: rgb(45, 45, 45);
}

.line3 {
  position: relative;
  top: -25px;
  height: 2px;
  width: 100%;
  color: rgb(45, 45, 45);
}
.line4 {
  position: relative;
  top: -25px;
  height: 2px;
  width: 100%;
  color: rgb(45, 45, 45);
}

.line5 {
  position: relative;
  margin-top:23px;
  height: 2px;
  width: 100%;
  color: rgb(45, 45, 45);
}

.title1 {
  font-size: 19px;
  letter-spacing: 5px;
  color: rgb(71, 71, 71);
}

.hot_show {
  display: flex;
  justify-content: space-around;
  /* background-color: aqua; */
  width: 60%;
  height: 650px;
  margin: auto;
}

.left_board {
  width: 65%;
  height: 100%;
  /* background-color: blueviolet; */
}
.left_up_block {
  width: 100%;
  height: 65%;
  /* background-color: brown; */
  box-shadow: inset 0px -150px 150px rgb(20, 20, 20);
  overflow: hidden;
}
.left_up_block:hover .left_up_photo,
.left_up_block:focus .left_up_photo {
  -ms-transform: scale(1.05);
  -moz-transform: scale(1.05);
  -webkit-transform: scale(1.05);
  -o-transform: scale(1.05);
  transform: scale(1.05);
  transition: all 0.3s ease-in;
}
.left_up_title1 {
  position: relative;
  top: -160px;
  left: 4%;
  color: rgb(227, 227, 227);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.left_up_title1:hover{
  cursor: pointer;
}
.left_up_title2 {
  position: relative;
  top: -170px;
  left: 4%;
  color: white;
  font-size: 16px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.left_up_title2:hover{
  cursor: pointer;
}
.left_up_title3 {
  position: relative;
  top: -180px;
  left: 4%;
  color: rgb(227, 227, 227);
  font-size: 11px;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.left_up_title3:hover{
  cursor: pointer;
}
.left_up_title4 {
  width: 90%;
  position: relative;
  top: -180px;
  left: 4%;
  color: white;
  font-size: 17px;
  font-weight: bold;
  letter-spacing: 0.5px;
  line-height: 20px;
  font-family: Times New Roman, Microsoft YaHei, Arial, Helvetica;
}
.left_up_title4:hover{
  cursor: pointer;
}
.left_up_photo {
  width: 100%;
  height: 100%;
  position: relative;
  z-index: -1;
  vertical-align: top;
  transition: all 0.3s ease-in 0s;
}
.left_down_block {
  width: 100%;
  height: 35%;
  /* background-color: rgb(0, 0, 0); */
  display: flex;
  justify-content: space-around;
}
.left_down_title_block1 {
  width: 50%;
  height: 100%;
  /* background-color: rgb(81, 255, 0); */
  padding-right: 5%;
}
.left_down_title1 {
  padding-top: 20px;
  height: 20px;
  position: relative;
  color: rgb(224, 1, 1);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.left_down_title2 {
  position: relative;
  top: -5px;
  height: 20px;
  color: rgb(69, 69, 69);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.left_down_title3 {
  position: relative;
  color: black;
  top: -25px;
  line-height: 35px;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.left_down_title3:hover {
  cursor: pointer;
}
.left_down_title4 {
  width: 80%;
  position: relative;
  top: -30px;
  color: rgb(47, 46, 46);
  font-size: 11px;
  letter-spacing: 0.5px;
  line-height: 20px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.left_down_title_block2 {
  width: 50%;
  height: 100%;
  padding-right: 5%;
  /* background-color: rgb(0, 30, 255); */
}
.right_board {
  /* background-color: rgb(43, 226, 119); */
  width: 30%;
  height: 100%;
  margin-left: 5%;
}
.right_up_block {
  /* background-color: rgb(204, 124, 165); */
  width: 100%;
  height: 50%;
  padding-bottom: 20px;
}
.right_up_photo_block {
  width: 100%;
  height: 45%;
  overflow: hidden;
}
.right_up_photo {
  width: 100%;
  height: 100%;
  transition: all 0.3s ease-in 0s;
}
.right_up_block:hover .right_up_photo,
.right_up_block:focus .right_up_photo {
  -ms-transform: scale(1.05);
  -moz-transform: scale(1.05);
  -webkit-transform: scale(1.05);
  -o-transform: scale(1.05);
  transform: scale(1.05);
  transition: all 0.3s ease-in;
}
.right_up_title1 {
  position: relative;
  color: rgb(224, 1, 1);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.right_up_title2 {
  position: relative;
  top: -28px;
  left: 230px;
  color: rgb(69, 69, 69);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.right_up_title3 {
  position: relative;
  color: black;
  top: -40px;
  line-height: 35px;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.5px;
  width: 90%;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.right_up_title3:hover{
  cursor: pointer;
}
.right_up_title4 {
  width: 80%;
  position: relative;
  top: -55px;
  color: rgb(47, 46, 46);
  font-size: 11px;
  letter-spacing: 0.5px;
  line-height: 20px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.right_down_block {
  /* background-color: rgb(0, 179, 255); */
  width: 100%;
  height: 50%;
}
.right_down_photo_block {
  width: 100%;
  height: 45%;
  overflow: hidden;
}
.right_down_photo {
  width: 100%;
  height: 100%;
  transition: all 0.3s ease-in 0s;
}
.right_down_block:hover .right_down_photo,
.right_down_block:focus .right_down_photo {
  -ms-transform: scale(1.05);
  -moz-transform: scale(1.05);
  -webkit-transform: scale(1.05);
  -o-transform: scale(1.05);
  transform: scale(1.05);
  transition: all 0.3s ease-in;
}
.right_down_title1 {
  position: relative;
  color: rgb(224, 1, 1);
  font-size: 11px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.right_down_title2 {
  position: relative;
  top: -27px;
  left: 158px;
  color: rgb(69, 69, 69);
  font-size: 12px;
  font-weight: bold;
  letter-spacing: 0.5px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.right_down_title3 {
  position: relative;
  color: black;
  top: -40px;
  line-height: 35px;
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 0.5px;
  width: 90%;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}
.right_down_title3:hover{
  cursor: pointer;
}
.right_down_title4 {
  width: 80%;
  position: relative;
  top: -55px;
  color: rgb(47, 46, 46);
  font-size: 11px;
  letter-spacing: 0.5px;
  line-height: 20px;
  font-family: Microsoft YaHei, Arial, Helvetica, sans-serif;
}

.recommend {
  width: 60%;
  margin: auto;
  margin-top: 70px;
  /* background-color: aqua; */
  min-height: 590px;
}

.recom_title_block {
  display: flex;
  vertical-align: top;
}

.recom_title {
  font-size: 20px;
  font-weight: bold;
  letter-spacing: 5px;
  color: rgb(30, 30, 30);
  margin-top: 4px;
  margin-left: 1%;
}

.recom_board{
  margin-top:5px;
  width:100%;
  height:100%;
}

.recom_entry{
  height: 33%;
  width:95%;
  margin:auto;
}

.recom_entry_title{
}

.recom_type{
  vertical-align:top;
  color: white;
  font-size:15px;
  background-color: rgb(61, 61, 175);
  width:45px;
  text-align: center;
  line-height: 23px;
  letter-spacing:2px;
  border-radius: 6px;
  display: inline-block;
}

.recom_entry_title_content{
  width:80%;
  display: inline-block;
  margin-left:20px;
  font-size:19px;
  letter-spacing: 1px;
  cursor: pointer;
}

.recom_entry_content{
  font-size:17px;
  color: rgb(111, 111, 111);
  line-height: 27px;
  margin-top:-5px;
  letter-spacing: 1px;
}

.recom_entry_bottom{
  margin-top:-8px;
  color:rgb(147, 147, 147);
}

.el-icon-s-flag {
  font-size: 30px;
  color: rgb(61, 61, 175);
}

.logo {
  height: 115px;
  width: 115px;
  margin-top: -10px;
  text-align: center;
}

.top-search {
  width: 60%;
  height: 50px;
  margin-top: 10px;
}

.search-box {
  display: flex;
  position: relative;
}

.search-left {
  width: 100%;
  height: 50px;
  border: 2px solid rgb(196, 199, 206);
  border-radius: 15px;
  outline: none;
  box-shadow: 0 2px 12px 0 rgba(0, 0, 0, 0.1);
  font-size: 18px;
  padding-left: 15px;
  padding-right: 70px;
}
.search-left:focus {
  border: 2px solid rgb(93, 150, 224);
}
.search-left:hover {
  border: 2px solid rgb(93, 150, 224);
}
.el-icon-search {
  font-weight: bold;
  font-size: 27px;
  color: rgb(136, 136, 136);
  margin-left: -6%;
  margin-top: 1.6%;
}

.el-icon-search:hover {
  cursor: pointer;
  color: rgb(61, 61, 175);
}
.select {
  width: 100px;
  margin-right: 2%;
  margin-left: -15%;
}
.selectbox {
  width: 130px;
  margin-left: -150px;
}
::v-deep .selectbox .el-input--small .el-input__inner {
  padding-left: 10px;
  height: 50px;
  border-radius: 5px;
  color: rgb(136, 136, 136);
  font-size: 18px;
  border: none;
  letter-spacing: 2px;
  text-align: center;
}

.selectbox ::v-deep.el-input__inner {
  background-size: 17px 19px;
  background-position: 12px 14px;
  padding: 0 0 0 26px;
  box-sizing: border-box;
  font-size: 14px;
}

::v-deep.selectbox .el-icon-arrow-up::before {
  /* content:''; */
  position: absolute;
  width: 100%;
  height: 100%;
  top: 65%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-weight: bold;
}
::v-deep .selectbox .el-input--small input::-webkit-input-placeholder {
  color: rgb(136, 136, 136);
}

input::-webkit-input-placeholder {
  /* 使用webkit内核的浏览器 */
  color: rgb(196, 199, 206);
}
input:-moz-placeholder {
  /* Firefox版本4-18 */
  color: rgb(196, 199, 206);
}
input::-moz-placeholder {
  /* Firefox版本19+ */
  color: rgb(196, 199, 206);
}
input:-ms-input-placeholder {
  /* IE浏览器 */
  color: rgb(196, 199, 206);
}
::v-deep .el-input__inner {
  border: none;
  box-shadow: none;
}
</style>